package cn.fl.ass.service.impl;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import cn.cmm.base.framework.logger.eum.LogExceptionEnum;
import cn.cmm.base.framework.utils.*;
import cn.fl.ass.transform.ProductStatusLogTransform;
import cn.fl.ass.vo.ProductStatusLogVO;
import cn.fl.capital.condition.CapOverdueInfoQueryCondition;
import cn.fl.capital.constant.CapitalConstant;
import cn.fl.capital.service.ICapOverdueInfoService;
import cn.fl.capital.vo.CapOverdueInfoVO;
import cn.fl.project.condition.PrjPaySchMYqQC;
import cn.fl.project.condition.PrjPrdPaySchDQueryCondition;
import cn.fl.project.dto.PrjPrdPaySchMDTO;
import cn.fl.project.service.*;
import cn.fl.project.vo.PrjBscInfoVO;
import cn.fl.project.vo.PrjPaySchMYqVO;
import cn.fl.project.vo.PrjPrdPaySchDVO;
import cn.fl.project.vo.PrjPrdPaySchMVO;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import fl.ass.facade.constant.InterfaceConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cmm.comm.facade.framework.api.ISysDictionaryApiService;
import cmm.comm.facade.framework.dto.SysDictionaryDTO;
import cmm.mid.core.framework.dto.DataResultDTO;
import cmm.mid.core.framework.page.DataResultVO;
import cmm.mid.core.framework.page.KeyValueVO;
import cmm.mid.core.framework.page.Pager;
import cn.cmm.base.framework.constant.BaseConstant;
import cn.cmm.base.framework.constant.BaseExceptionConstant;
import cn.cmm.base.framework.exception.BaseException;
import cn.fl.ass.service.IAssTrailCarMService;
import cn.fl.ass.transform.AssTrailCarMVOTransform;
import cn.fl.ass.vo.AssTrailCarMVO;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.system.condition.SysBkAccInfoQueryCondition;
import cn.fl.system.condition.SysBkInfoQueryCondition;
import cn.fl.system.dto.SysBkAccInfoDTO;
import cn.fl.system.dto.SysBkInfoDTO;
import cn.fl.system.service.ISysBkInfoApiService;
import cn.fl.system.transform.SysBkAccInfoVOTransform;
import cn.fl.system.transform.SysBkInfoVOTransform;
import cn.fl.system.vo.SysBkAccInfoVO;
import cn.fl.system.vo.SysBkInfoVO;
import fl.ass.facade.api.IAssTrailCarApi;
import fl.ass.facade.condition.AssDealCarQueryCondition;
import fl.ass.facade.condition.AssTrailCarDQueryCondition;
import fl.ass.facade.condition.AssTrailCarHvQueryCondition;
import fl.ass.facade.dto.AssTrailCarMDTO;
import fl.ass.facade.dto.MessageDTO;
import fl.flow.facade.flow.api.IFlowQueryApiService;
import fl.flow.facade.flow.condition.SysFlowSHQueryCondition;
import fl.flow.facade.flow.dto.SysFlowSHDTO;

/**
 * @Description: 拖车信息主表 客户端服务层接口实现
 * @Description: 业务层方法名称前缀：新增：add* 删除：remove* 修改：modify* 查询对象：select* get* 批量：batch* 查询集合：search*
 */
@Service
public class AssTrailCarMServiceImpl implements IAssTrailCarMService {

	/**
	 * 日志
	 */
	private static final Logger logger = LoggerFactory.getLogger(IAssTrailCarMService.class);
	
	/**
	 * 拖车模块 API 暴露服务
	 */
	@Autowired
	private IAssTrailCarApi assTrailCarApi;
	
	/**
	 * 数据字典 API 暴露服务
	 */
	@Autowired
	private ISysDictionaryApiService sysDictionaryApi;
	
	/**
	 * 查询流程API 暴露服务
	 */
	@Autowired
	private IFlowQueryApiService flowQueryApi;
	
	/**
	 * 查询银行API 暴露服务
	 */
	@Autowired
	private ISysBkInfoApiService sysBkInfoApi;

	@Autowired
    private IPrjPaySchMYqService prjPaySchMYqService;

	@Autowired
    private IPrjBscInfoService prjBscInfoService;

	@Autowired
    private IPrjPrdPaySchDService prjPrdPaySchDService;

	@Autowired
    private IPrjPrdPaySchMService prjPrdPaySchMService;

	@Autowired
    private ICapOverdueInfoService capOverdueInfoService;

	@Autowired
    private IPrjPrdPaySchMApiService prjPrdPaySchMApiService;

	@Override
	public AssTrailCarMVO selectById(Long id) throws BaseException{
		if(StringUtils.isEmpty(id)){
			return null;
		}
		//查询拖车主表信息
		MessageDTO<AssTrailCarMDTO> response = this.assTrailCarApi.findAssTrailCarMasterById(id);
		return AssTrailCarMVOTransform.toVO(response.getData());
	}

	@Override
	public Long add(AssTrailCarMVO entity) throws BaseException{
		if(null == entity){
			return null;
		}
		//返回新增ID值-JL-20170320
		//MessageDTO<String> response = this.assTrailCarApi.saveAssTrailCarM(AssTrailCarMVOTransform.toDTO(entity));
		MessageDTO<String> response = this.assTrailCarApi.saveAssTrailCarInfo(AssTrailCarMVOTransform.toDTO(entity));
		return response.getId();
	}

	@Override
	public boolean removeById(Long id) throws BaseException{
		if(StringUtils.isEmpty(id)){
			return false;
		}
		//return this.assTrailCarMApiService.removeById(id);
		//TODO 业务逻辑
		return false;
	}
	
	/**
     * 删除
     * @param ids
     * @return
     */
    public boolean removeByIds(List<Long> ids)throws BaseException{
    	if(CollectionUtils.isEmpty(ids)){
			return false;
		};
		return false;
    }

	@Override
	public boolean modify(AssTrailCarMVO entity) throws BaseException{
		if(null == entity){
			return false;
		}
		//返回逻辑值-JL-20170315
		MessageDTO<String> response = this.assTrailCarApi.modifyMaster(AssTrailCarMVOTransform.toDTO(entity));
		return response.isSuccess();
	}

	@Override
	public Pager searchListPage(Pager page) throws BaseException{
		if(null == page)page = new Pager();
		return this.assTrailCarApi.findTrailCarByPager(page);
	}
	
	/**
     * 拖车模块-发起流程
     * @param qc
     * @return
     * @throws BaseException
     */
	@Override
    public DataResultVO addTrailCarApply(AssTrailCarDQueryCondition qc) throws BaseException {
		DataResultVO resultVO = null;
        //发起流程
        DataResultDTO resultDTO = this.assTrailCarApi.addTrailCarApply(qc);
        if(resultDTO != null){
            resultVO = new DataResultVO(Integer.parseInt(resultDTO.getCode()),resultDTO.getInfo());
            resultVO.setData(resultDTO.getData());
        }else{
            resultVO = new DataResultVO(BaseConstant.IS_YESNO_NO,"拖车模块-流程发起失败");
        }
        return resultVO;
    }
	
	/**
	 * 根据字段代码组获取代码值集合
	 * @param grpCd 代码组值
	 * @param sysCd 系统代码
	 * @param orgCd 组织结构代码
	 * @return 值
	 * @throws BaseException
	 */
	@Override
	public List<KeyValueVO> getKvList(String grpCd, String sysCd, String orgCd) throws BaseException {
		List<KeyValueVO>  keyValueList = null;
		List<SysDictionaryDTO>  dictionaryList = this.sysDictionaryApi.searchGroup(sysCd, orgCd, grpCd);
		if(CollectionUtils.isNotEmpty(dictionaryList)){
			keyValueList = new ArrayList<>();
			for (SysDictionaryDTO sysDictionaryDTO : dictionaryList) {
				KeyValueVO keyValue = new KeyValueVO();
				keyValue.setKey(sysDictionaryDTO.getCode());
				keyValue.setValue(sysDictionaryDTO.getCodeNm());
				keyValueList.add(keyValue);
			}
		}
		return keyValueList;
	}
	
	/**
     * 分页查询所有拖车相关流程
     * @param qc
     * @return
     */
	@Override
	public List<SysFlowSHDTO> searchFlowListPage(SysFlowSHQueryCondition qc) throws BaseException{
		if(null == qc){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"查询对象不能为空!");
		}
		return this.flowQueryApi.searchFlowSHList(qc);
	}
	
	/**
	 * 导出拖车模块信息
	 */
	@Override
	public String exportAssInfo(AssTrailCarDQueryCondition qc1, AssDealCarQueryCondition qc2,AssTrailCarHvQueryCondition qc3, String orgCd, String eFlag) throws BaseException {
		if(null==qc1 && null==qc2 && null == qc3){
			qc1 = new AssTrailCarDQueryCondition();
			qc2 = new AssDealCarQueryCondition();
			qc3 = new AssTrailCarHvQueryCondition();
		}
		if(StringUtils.isEmpty(orgCd)){
			orgCd = CurrentThreadContext.getCurrentOrgCd();
		}
		return this.assTrailCarApi.exportAssInfo(qc1, qc2,qc3, orgCd, eFlag);
	}
	
	/**
	 * 获取付款银行信息
	 * @param qc
	 * @return
	 * @throws BaseException
	 */
	@Override
	public List<KeyValueVO> searchBankNmKVList(SysBkInfoQueryCondition qc, String sysCd, String orgCd) throws BaseException {
		List<KeyValueVO> kvList = new ArrayList<KeyValueVO>();
		List<SysBkInfoVO> volist = new ArrayList<SysBkInfoVO>();
		List<SysBkInfoDTO> dtolist = new ArrayList<SysBkInfoDTO>();
		dtolist = this.sysBkInfoApi.searcheOpenBkInfo(qc, sysCd, orgCd);
		volist = SysBkInfoVOTransform.toVOList(dtolist);
		//转换成键值对
		if(CollectionUtils.isNotEmpty(volist)){
			for (SysBkInfoVO vo : volist) {
				KeyValueVO kv = new KeyValueVO();
				kv.setKey(vo.getId().toString());//银行ID
				kv.setValue(vo.getBkNm());//银行名称
				kvList.add(kv);
			}
		}else{
			BaseLogUtils.newLogger("获取到的付款银行信息数据为空");
		}
		return kvList;
	}
	
	/**
	 * 获取付款银行-账号信息
	 * @param qc
	 * @return
	 * @throws BaseException
	 */
	@Override
	public List<KeyValueVO> searchAccNoKVList(SysBkAccInfoQueryCondition qc, String sysCd, String orgCd) throws BaseException {
		List<KeyValueVO> kvList = new ArrayList<KeyValueVO>();
		List<SysBkAccInfoVO> volist = new ArrayList<SysBkAccInfoVO>();
		List<SysBkAccInfoDTO> dtolist = new ArrayList<SysBkAccInfoDTO>();
		dtolist = this.sysBkInfoApi.searchSysBkAccInfoList(qc, sysCd, orgCd);
		volist = SysBkAccInfoVOTransform.toVOList(dtolist);
		//转换成键值对
		if(CollectionUtils.isNotEmpty(volist)){
			for (SysBkAccInfoVO vo : volist) {
				KeyValueVO kv = new KeyValueVO();
				kv.setKey(vo.getId().toString());//银行ID
				kv.setValue(vo.getAccNo());//银行账号
				kvList.add(kv);
			}
		}else{
			BaseLogUtils.newLogger("获取到的付款银行账号信息数据为空").info();
		}
		return kvList;
	}

    @Override
    public List<PrjPaySchMYqVO> searchYQPayInfo(Long prjPrdDtlId, Date appltDt) throws BaseException {
	    try {
            // 查车贷支付表
            List<Long> paySchIds = this.assTrailCarApi.searchPrjPrdPaySchIdsByPrjPrdDtlId(prjPrdDtlId);
            if (CollectionUtils.isEmpty(paySchIds)) {
                return null;
            }
            PrjPaySchMYqQC qc = new PrjPaySchMYqQC();
            qc.setPaySchIds(paySchIds);
            // 根据车贷支付表查yq支付表
            List<PrjPaySchMYqVO> prjPaySchMYqVOS = this.prjPaySchMYqService.searchList(qc);
            List<PrjPaySchMYqVO> prjPaySchMYqVOSNotEmpty = new ArrayList<>();
            for (PrjPaySchMYqVO prjPaySchMYqVO : prjPaySchMYqVOS) {
                if (StringUtils.isNotEmpty(prjPaySchMYqVO.getYqPaySchId())) {
                    prjPaySchMYqVOSNotEmpty.add(prjPaySchMYqVO);
                }
            }
            BaseLogUtils.newLogger("对应的YQ支付表信息为：").setKeys("prjPrdDtlId:" + prjPrdDtlId, "prjPaySchMYqVOSNotEmpty:" + JSON.toJSONString(prjPaySchMYqVOSNotEmpty)).info();
            if (CollectionUtils.isNotEmpty(prjPaySchMYqVOSNotEmpty)) {
                for (PrjPaySchMYqVO prjPaySchMYqVO : prjPaySchMYqVOSNotEmpty) {
                    Long yqPaySchId = prjPaySchMYqVO.getYqPaySchId();
                    PrjPrdPaySchMVO prjPrdPaySchMVO = this.prjPrdPaySchMService.selectById(yqPaySchId);
                    PrjBscInfoVO prjBscInfoVO = prjBscInfoService.selectById(prjPrdPaySchMVO.getPrjId());
                    // 合同号
                    prjPaySchMYqVO.setContNo(prjBscInfoVO.getLsCntNo());
                    // 实际贷款金额
                    prjPaySchMYqVO.setActualLoanAmt(prjPrdPaySchMVO.getActLsAmt().longValue());
                    PrjPrdPaySchDQueryCondition condition = new PrjPrdPaySchDQueryCondition();
                    condition.setPaySchId(yqPaySchId);
                    condition.setIsDel(BaseConstant.IS_YESNO_NO);
                    List<String> feeTypCdList = new ArrayList<>();
                    feeTypCdList.add(CapitalConstant.CODE_FEE_TYP_CD_S03);
                    feeTypCdList.add(CapitalConstant.CODE_FEE_TYP_CD_S02);
                    condition.setIncludeFeeTypCdList(feeTypCdList);
                    condition.setSortName("PAY_PD");
                    condition.setSortOrder("ASC");
                    List<PrjPrdPaySchDVO> prjPrdPaySchDVOS = prjPrdPaySchDService.searchList(condition);
                    List<PrjPrdPaySchDVO> prjPrdPaySchDVOS02 = new ArrayList<>(prjPrdPaySchDVOS.size());
                    if (CollectionUtils.isNotEmpty(prjPrdPaySchDVOS)) {
                        // 已还本金
                        Long paidCapAmt = 0L;
                        // 已还利息
                        Long paidIntrAmt = 0L;
                        // 剩余本金
                        Long surplusCapAmt = 0L;
                        // 剩余利息
                        Long surplusIntrAmt = 0L;
                        for (PrjPrdPaySchDVO prjPrdPaySchDVO : prjPrdPaySchDVOS) {
                            if (CapitalConstant.CODE_FEE_TYP_CD_S03.equals(prjPrdPaySchDVO.getFeeTypCd())) {
                                // 本金
                                paidCapAmt += prjPrdPaySchDVO.getPaidUpAmt();
                                surplusCapAmt += prjPrdPaySchDVO.getArAmt();
                            } else if (CapitalConstant.CODE_FEE_TYP_CD_S02.equals(prjPrdPaySchDVO.getFeeTypCd())) {
                                // 利息
                                paidIntrAmt += prjPrdPaySchDVO.getPaidUpAmt();
                                surplusIntrAmt += prjPrdPaySchDVO.getArAmt();
                                prjPrdPaySchDVOS02.add(prjPrdPaySchDVO);
                            }
                        }
                        prjPaySchMYqVO.setPaidCapAmt(paidCapAmt);
                        prjPaySchMYqVO.setPaidIntrAmt(paidIntrAmt);
                        prjPaySchMYqVO.setSurplusCapAmt(surplusCapAmt);
                        prjPaySchMYqVO.setSurplusIntrAmt(surplusIntrAmt);
                    }
                    CapOverdueInfoQueryCondition capOverdueInfoQueryCondition = new CapOverdueInfoQueryCondition();
                    capOverdueInfoQueryCondition.setPaySchId(yqPaySchId);
                    capOverdueInfoQueryCondition.setDataStatusCd(BaseConstant.IS_YESNO_NO_STR);
                    capOverdueInfoQueryCondition.setIsDel(0);
                    capOverdueInfoQueryCondition.setUsrId(CurrentThreadContext.getCurrentUserId());
                    capOverdueInfoQueryCondition.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
                    capOverdueInfoQueryCondition.setSysCd(CurrentThreadContext.getCurrentSysCd());
                    List<CapOverdueInfoVO> capOverdueInfoVOS = capOverdueInfoService.searchList(capOverdueInfoQueryCondition);
                    if (CollectionUtils.isNotEmpty(capOverdueInfoVOS)) {
                        // 逾期租金
                        Long ovdRentAmount = 0L;
                        // 已还罚息
                        Long paidPenaltyAmt = 0L;
                        for (CapOverdueInfoVO capOverdueInfoVO : capOverdueInfoVOS) {
                            ovdRentAmount += capOverdueInfoVO.getOverdueAmount();
                            paidPenaltyAmt += capOverdueInfoVO.getPayAmount();
                        }
                        prjPaySchMYqVO.setOverRentAmt(ovdRentAmount);
                        prjPaySchMYqVO.setPaidPenaltyAmt(paidPenaltyAmt);
                    }
                    Integer payPd = getPayPd(prjPrdPaySchDVOS02);
                    // 获得结清金额（应收款金额）
                    PrjPrdPaySchMDTO prjPrdPaySchMDTO = this.prjPrdPaySchMApiService.searchSettleData(yqPaySchId, appltDt, "11000", "0000", payPd);
                    prjPaySchMYqVO.setClearAmt(prjPrdPaySchMDTO.getFinalPayAmt().longValue());
                }
            }
            return prjPaySchMYqVOSNotEmpty;
        } catch (BaseException e) {
            BaseLogUtils.newLogger("查询疫情数据失败").setKeys("prjPrdDtlId:" + prjPrdDtlId).setThrowable(e).setWarning(false).error(LogExceptionEnum.COMMON_CODE_0002);
            throw e;
        } catch (Exception e) {
            BaseLogUtils.newLogger("查询疫情数据失败").setKeys("prjPrdDtlId:" + prjPrdDtlId).setThrowable(e).setWarning(false).error(LogExceptionEnum.COMMON_CODE_0002);
            throw e;
        }
    }

    private Integer getPayPd(List<PrjPrdPaySchDVO> prjPrdPaySchDVOS) throws BaseException {
	    Integer payPd = null;
	    Date now = DateUtils.getCurrentDate(DateUtils.YYYY_MM_DD);
        if (now.after(prjPrdPaySchDVOS.get(prjPrdPaySchDVOS.size() - 1).getPayDt())) {
            return 0;
        }
        for (PrjPrdPaySchDVO prjPrdPaySchDVO : prjPrdPaySchDVOS) {
            if (prjPrdPaySchDVO.getPayDt().compareTo(now) >= 0) {
                payPd = prjPrdPaySchDVO.getPayPd();
                break;
            }
        }
        return payPd;
    }

    @Override
    public JSONObject searchYQOvdAndFutureAmt(Long paySchId) throws BaseException {
        JSONObject json = new JSONObject();
        try {
            PrjPaySchMYqQC qc = new PrjPaySchMYqQC();
            qc.setPaySchId(paySchId);
            // 根据车贷支付表查yq支付表
            List<PrjPaySchMYqVO> prjPaySchMYqVOS = this.prjPaySchMYqService.searchList(qc);
            if (CollectionUtils.isNotEmpty(prjPaySchMYqVOS)) {
                // 逾期租金
                Long ovdRentAmt = 0L;
                // 未来本金
                Long futureCapAmt = 0L;
                for (PrjPaySchMYqVO prjPaySchMYqVO : prjPaySchMYqVOS) {
                    Long yqPaySchId = prjPaySchMYqVO.getYqPaySchId();
                    if (StringUtils.isEmpty(yqPaySchId)) {
                        continue;
                    }
                    PrjPrdPaySchDQueryCondition condition = new PrjPrdPaySchDQueryCondition();
                    condition.setPaySchId(yqPaySchId);
                    condition.setIsDel(BaseConstant.IS_YESNO_NO);
                    condition.setPayDtMin(DateUtils.formatDateToString(new Date(), DateUtils.YYYY_MM_DDHHMMSS));
                    condition.setFeeTypCd(CapitalConstant.CODE_FEE_TYP_CD_S03);
                    List<PrjPrdPaySchDVO> prjPrdPaySchDVOS = prjPrdPaySchDService.searchList(condition);
                    if (CollectionUtils.isNotEmpty(prjPrdPaySchDVOS)) {
                        for (PrjPrdPaySchDVO prjPrdPaySchDVO : prjPrdPaySchDVOS) {
                            // 未来本金
                            futureCapAmt += prjPrdPaySchDVO.getArAmt();
                        }
                    }
                    CapOverdueInfoQueryCondition capOverdueInfoQueryCondition = new CapOverdueInfoQueryCondition();
                    capOverdueInfoQueryCondition.setPaySchId(yqPaySchId);
                    capOverdueInfoQueryCondition.setDataStatusCd(BaseConstant.IS_YESNO_NO_STR);
                    capOverdueInfoQueryCondition.setIsDel(0);
                    capOverdueInfoQueryCondition.setUsrId(CurrentThreadContext.getCurrentUserId());
                    capOverdueInfoQueryCondition.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
                    capOverdueInfoQueryCondition.setSysCd(CurrentThreadContext.getCurrentSysCd());
                    List<CapOverdueInfoVO> capOverdueInfoVOS = capOverdueInfoService.searchList(capOverdueInfoQueryCondition);
                    if (CollectionUtils.isNotEmpty(capOverdueInfoVOS)) {
                        for (CapOverdueInfoVO capOverdueInfoVO : capOverdueInfoVOS) {
                            // 逾期租金
                            ovdRentAmt += capOverdueInfoVO.getOverdueAmount();
                        }
                    }
                }
                json.put("ovdRentAmt", ovdRentAmt);
                json.put("futureCapAmt", futureCapAmt);
            }
            return json;
        } catch (BaseException e) {
            BaseLogUtils.newLogger("查询疫情逾期租金和未来本金数据失败").setKeys("paySchId:" + paySchId).setThrowable(e).setWarning(false).error(LogExceptionEnum.COMMON_CODE_0002);
            throw e;
        } catch (Exception e) {
            BaseLogUtils.newLogger("查询疫情逾期租金和未来本金数据失败").setKeys("paySchId:" + paySchId).setThrowable(e).setWarning(false).error(LogExceptionEnum.COMMON_CODE_0002);
            throw e;
        }
    }

    @Override
    public void updateYQPrdStsCdByFlow(ProductStatusLogVO productStatusLogVO) throws BaseException {
        this.assTrailCarApi.updateYQPrdStsCdByFlow(ProductStatusLogTransform.toDTO(productStatusLogVO));
    }

    @Override
    public boolean checkDealOrTransUsedFlowStart(Long assMainId) throws BaseException {
        return this.assTrailCarApi.checkDealOrTransUsedFlowStart(assMainId);
    }

    @Override
    public String isNeedValid(Long dataId) throws BaseException {

        SysFlowSHQueryCondition condition = new SysFlowSHQueryCondition();
        condition.setDataId(dataId);
        condition.setSysCd(InterfaceConstants.SYS_CODE);
        condition.setWordsInTheTable("ASS");
        List<SysFlowSHDTO> sysFlowSHDTOS = flowQueryApi.searchFlowSHList(condition);
        if (CollectionUtils.isNotEmpty(sysFlowSHDTOS)) {
            Date crtTm = sysFlowSHDTOS.get(0).getCrtTm();
            SysDictionaryDTO dto = this.sysDictionaryApi.searchGroup(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), "ASS0030").get(0);
            Date date = DateUtils.formatStringToDate(dto.getCode(), DateUtils.YYYY_MM_DDHHMMSS);
            if (crtTm.after(date)) {
                return "1";
            }
        }
        return null;
    }
}
